Dc offset compensation in zero-intermediate frequency mode of a receiver

ABSTRACT

A method for operating a radio frequency communications system includes, while operating a first radio frequency communications device in a calibration mode, for each setting of a plurality of settings of a programmable gain amplifier in a receiver of the first radio frequency communications device configured in a zero-intermediate frequency mode of operation, generating an estimate of a DC offset in each of a plurality of digital samples received from an analog circuit path including the programmable gain amplifier, and storing in a corresponding storage element, a compensation value based on the estimate.

CROSS-REFERENCE TO RELATED APPLICATION(S)

This application is related to application Ser. No. ______, entitled“PHASE MEASUREMENTS FOR HIGH ACCURACY DISTANCE MEASUREMENTS,” namingJohn M. Khoury, Yan Zhao, and Michael Wu as inventors, application Ser.No. ______, entitled “FREQUENCY OFFSET COMPENSATION AT REFLECTOR DURINGFREQUENCY COMPENSATION INTERVAL,” naming Michael Wu, Wentao Li, and YanZhou as inventors, and application Ser. No. ______, entitled “CORRECTIONOF FREQUENCY OFFSET BETWEEN INITIATOR AND REFLECTOR,” naming Michael Wu,Wentao Li, Yan Zhou, and John M. Khoury as inventors, which applicationsare filed on the same date as the present application and areincorporated herein by reference.

BACKGROUND Field of the Invention

This disclosure relates to communications systems in general, and moreparticularly to radio frequency (RF) communications systems andassociated methods for measuring distance using phase measurements.

Description of the Related Art

In general, a location of a wireless device in a plane (i.e., twodimensions) can be determined using triangulation (e.g., using two anglemeasurements), trilateration (e.g., using three distance measurements),or a combination thereof. Ranging techniques include Received SignalStrength Indicator (RSSI)-based, time-based and phase-based distancemeasurement. Since RSSI-based measurement is susceptible to multi-pathfading and complicated noise interference in indoor applications,time-based or phase-based distance measurement is preferably used inshort range radio frequency communications systems (e.g., systemscompliant with Bluetooth™, Bluetooth™ Low Energy (BLE), Zigbee™, orother local area network protocol standards).

Bluetooth Low Energy is an exemplary communications protocol designedfor low power and low latency applications. A BLE device (i.e., a devicecompliant with the BLE standardized communications protocol) consumessubstantially less power than conventional Bluetooth (i.e., Bluetoothclassic) devices (i.e., devices compliant with the Bluetoothstandardized communications protocol). An exemplary BLE device can startdata transmission much faster than conventional Bluetooth devices.Accordingly, BLE devices can be on constantly or frequently turned onand off so they can communicate intermittently with other devices. A BLEcommunications device implements phase-based distance measurements.Phase-based distance measurements rely on the phase shift ϕ introducedby a pure line of sight radio channel on a radio signal being a linearfunction of frequency f and range R, i.e.,

${\phi = {2\pi\; f\frac{R}{c}\mspace{14mu}\left( {{mod}\mspace{14mu} 2\pi} \right)}},$

where c is the speed of light in a vacuum. Thus, the BLE devicedetermines a distance between itself and another BLE device by measuringthe slope of the phase as a function of frequency.

A BLE device that starts the ranging-technique is referred to as aninitiator. Another BLE device that responds to the initiator is referredto as a reflector. After a frequency calibration phase, the initiatortransmits a local oscillator signal (i.e., a continuous wave tone havingfrequency f_(k)) to the reflector using a first channel. The reflectormeasures phase ϕ_(R) of the received carrier to determine the phase ofthe initiator local oscillator as seen at the reflector:

${\phi_{R} = {{{- 2}\pi\;{f_{k}\left( {\frac{R}{c} - \Delta_{t}} \right)}} - {\theta\mspace{14mu}\left( {{mod}\mspace{14mu} 2\pi} \right)}}},$

where Δ_(t) is a time offset (i.e., propagation time) between theinitiator and reflector and θ is a phase difference between the localoscillator signal of the initiator and the local oscillator of thereflector. Phase ϕ_(R) depends on the local oscillator of the initiator,the local oscillator of the reflector, and the distance between them.However, in some embodiments of a BLE communications system, thefrequency (a frequency of 2.4 GHz) corresponds to a wavelength (e.g.,wavelength of approximately 12 cm) that causes phase to wrap, resultingin ambiguity in the distance measurement. That ambiguity is resolved bymeasuring the phase shift using two (or more) distinct tones (e.g.,tones having a different of 1 MHz):

$\phi_{R} = {{\phi_{R\; 1} - \phi_{R\; 2}} = {2{\pi\left( {f_{1} - f_{2}} \right)}\left( {\frac{R}{c} - \Delta_{t}} \right)\mspace{14mu}{\left( {{mod}\mspace{14mu} 2\pi} \right).}}}$

The phase still wraps but occurs with respect to a frequencycorresponding to f₁-f₂ (e.g., 1 MHz). Similarly, the reflector sendscontinuous wave tones over the same channel to the initiator so that theinitiator can measure phase ϕ₁ to determine the phase of the reflectorlocal oscillator as seen at the initiator:

${\phi_{I} = {{{- 2}\pi\;{f_{k}\left( {\frac{R}{c} + \Delta_{t}} \right)}} + {\theta\mspace{14mu}\left( {{mod}\mspace{14mu} 2\pi} \right)}}};$$\phi_{I} = {{\phi_{I\; 1} - \phi_{I\; 2}} = {2{\pi\left( {f_{1} - f_{2}} \right)}{\left( {\frac{R}{c} - \Delta_{t}} \right).}}}$

The communications devices may repeat this procedure for at least oneadditional channel in the frequency band to reduce effects of multipathfading on the distance measurement and other impairments.

The reflector sends phase measurements to the initiator. The initiatorcalculates round trip phase ϕ_(RT) by adding the two phase measurementstogether:

$\phi_{RT} = {{\phi_{I} + \phi_{R}} = {4{\pi\left( {f_{1} - f_{2}} \right)}{\frac{R}{c}.}}}$

The initiator calculates the round trip range R:

${R = {\frac{c\left( {\phi_{{RT}\; 1} - \phi_{{RT}\; 2}} \right)}{4{\pi\left( {f_{1} - f_{2}} \right)}} = \frac{c\left( {\phi_{R\; 1} - \phi_{R\; 2}} \right)}{4{\pi\left( {f_{1} - f_{2}} \right)}}}},$

where ϕ_(RT1)=ϕ_(I1)+ϕ_(R1) and 2=ϕ_(I2)+ϕ_(R2). Note that θ, theconstant phase offset between the transmitter and receiver localoscillators of the reflector cancels when two frequencies are used tomeasure range R.

In at least one embodiment, the range calculation meets BLE standardizedcommunication protocol specifications in a high accuracy mode ofoperation if the range calculation is within ±10% for distances >5 m,and is <±0.50 m if the distance is <5 m for a target maximum distancemeasurement of approximately 50 m and a maximum speed of the initiatorwith respect to the reflector of 5 km/h. The phase measurementperformance at each device is critical to the round-trip rangecalculation. Noise or any frequency offset or frequency drift betweenthe local oscillator of the initiator and a target frequency and betweenthe local oscillator of the reflector and the target frequency canintroduce error into the range measurement. Accordingly, techniques thatreduce or eliminate effects of noise or frequency offset or frequencydrift on phase measurements are desired.

SUMMARY OF EMBODIMENTS OF THE INVENTION

In at least one embodiment, a method for operating a radio frequencycommunications system includes, while operating a first radio frequencycommunications device in a calibration mode, for each setting of aplurality of settings of a programmable gain amplifier in a receiver ofthe first radio frequency communications device configured in azero-intermediate frequency mode of operation, generating an estimate ofa DC offset in each of a plurality of digital samples received from ananalog circuit path including the programmable gain amplifier, andstoring in a corresponding storage element, a compensation value basedon the estimate.

In at least one embodiment, a radio frequency communications systemincludes a first radio frequency communications device having acalibration mode of operation and a normal mode of operation. The firstradio frequency communications device includes a receiver having azero-intermediate frequency mode of operation and a low-intermediatefrequency mode of operation. The receiver includes an analog circuitpath comprising a programmable gain amplifier configurable to have anactive setting of a plurality of settings. The receiver includes adigital circuit path configured to receive a plurality of digitalsamples from the analog circuit path. In the calibration mode ofoperation, the receiver is configured in a zero-intermediate frequencymode and the digital circuit path is configured to generate an estimateof a DC offset in each of the plurality of digital samples and to storein a storage element corresponding to the active setting, a compensationvalue based on the estimate.

In at least one embodiment, a method for measuring a distance between afirst radio frequency communications device including a first localoscillator and a second radio frequency communications device includinga second local oscillator includes operating the first radio frequencycommunications device in a normal mode. The method includes, whileoperating a receiver of the first radio frequency communications devicein a zero-intermediate frequency mode: compensating digital in-phasesamples with an in-phase compensation value corresponding to an activesetting of an analog signal path, compensating digital quadraturesamples with a quadrature compensation value corresponding to the activesetting of the analog signal path, and generating a phase measurementbased on compensated digital in-phase samples and compensated digitalquadrature samples. The phase measurement is indicative of a phasedifference between the first local oscillator and the second localoscillator and the distance between the first radio frequencycommunications device and the second radio frequency communicationsdevice.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention may be better understood, and its numerousobjects, features, and advantages made apparent to those skilled in theart by referencing the accompanying drawings.

FIG. 1 illustrates a functional block diagram of an exemplary wirelesscommunications system.

FIG. 2 illustrates a functional block diagram of an exemplary receiverof a wireless communications device.

FIG. 3 illustrates a functional block diagram of an exemplary anglemeasurement technique including integration of samples prior to an anglecomputation for use in a distance measurement by a wirelesscommunications device.

FIG. 4 illustrates a functional block diagram of an exemplary anglemeasurement technique including averaging of computed angles for use ina distance measurement by a wireless communications device consistentwith at least one embodiment of the invention.

FIG. 5 illustrates a functional block diagram of an exemplary anglemeasurement technique including integration of samples prior to an anglecomputation and tracking of phase wrapping for use in a distancemeasurement by a communications device consistent with at least oneembodiment of the invention.

FIG. 6 illustrates a functional block diagram of an exemplary anglemeasurement technique that integrates samples over an interval thatavoids phase wrapping and averages computed angles for use in a distancemeasurement by a wireless communications device consistent with at leastone embodiment of the invention.

FIG. 7 illustrates exemplary timing diagrams of communications betweenwireless communications devices used in a distance measurementconsistent with at least one embodiment of the invention.

FIG. 8 illustrates a functional block diagram of portions of anexemplary receiver used to estimate and compensate for a DC offset insignals used in a distance measurement consistent with at least oneembodiment of the invention.

FIG. 9 illustrates a functional block diagram of portions of anexemplary receiver used to measure phase and to measure and compensatefor frequency offset in signals used in a distance measurementconsistent with at least one embodiment of the invention.

FIG. 10 illustrates exemplary information and control flows forcompensating for frequency offset during a frequency compensationinterval of communications between wireless communications devicesconsistent with at least one embodiment of the invention.

FIG. 11 illustrates exemplary information and control flows forcompensating for residual frequency offset and measuring phase usingpacket exchange and tone exchange communications between wirelesscommunications devices consistent with at least one embodiment of theinvention.

The use of the same reference symbols in different drawings indicatessimilar or identical items.

DETAILED DESCRIPTION

Referring to FIG. 1 in at least one embodiment, a wirelesscommunications system includes wireless communications device 102, whichincludes transmitter 104, receiver 106, data processing circuitry 107,memory 103, and local oscillator 105, and wireless communications device112, which includes transmitter 114, receiver 116, data processingcircuitry 138, memory 136, and local oscillator 115. Wirelesscommunications device 102 is distance R away from wirelesscommunications device 112. Although wireless communications device 102and wireless communications device 112 are illustrated as including onlyone antenna each, in other embodiments of wireless communications system100, wireless communications device 102 and wireless communicationsdevice 112 each include multiple antennas. Wireless communicationssystem 100 is compliant with the BLE standardized communicationsprotocol designed for low power and low latency applications. However,in other embodiments, wireless communications system 100 is compliantwith other wireless communications protocols (e.g., Bluetooth Classic,Zigbee, or other short-range radio frequency protocol standards). Localoscillator 105 and local oscillator 115 provide signals used intransceiver functions of wireless communications device 102 and wirelesscommunications device 112, respectively. If wireless communicationsdevice 102 and wireless communications device 112 are manufactured bydifferent vendors, then the frequency of local oscillator 105 can besubstantially different from the frequency of local oscillator 115.However, for phase measurements, the transmitted continuous wave signalssent by the initiator or reflector are nominally the same. If notproperly taken into account, random frequency errors between theinitiator and the reflector continuous wave signals (e.g., ±40 ppm oneach side) can introduce errors into a measurement of distance R made bywireless communications system 100.

FIG. 2 illustrates an exemplary embodiment of a receiver that may beincluded in wireless communications device 102 or wirelesscommunications device 112. Antenna 101 provides an RF signal to passivenetwork 120, which provides impedance matching, filtering, andelectrostatic discharge protection. Passive network 120 is coupled tolow-noise amplifier (LNA) 122, which amplifies the RF signal withoutsubstantial degradation to the signal-to-noise ratio and provides theamplified RF signal to frequency mixer 124. Frequency mixer 124 performsfrequency translation or shifting of the RF signal using a reference orlocal oscillator (LO) signal provided by local oscillator 115. Forexample, in at least one operational mode of receiver 116, frequencymixer 124 translates the RF signal frequencies to baseband frequenciescentered at DC (i.e., zero-intermediate frequency (ZIF) in a ZIF mode ofoperation). In another operational mode, receiver 116 is configured as alow-intermediate frequency (LIF) receiver (i.e., in a LIF mode ofoperation) and frequency mixer 124 translates the RF signal to alow-intermediate frequency (e.g., 100-200 kHz) to avoid DC offset and1/f noise problems of ZIF receivers.

Frequency mixer 124 provides the translated output signal as a set oftwo signals, an in-phase (I) signal, and a quadrature (Q) signal. The Iand Q signals are analog time-domain signals. In at least one embodimentof receiver 116, the analog amplifiers and filters 128 provide amplifiedand filtered versions of the I and Q signals to analog-to-digitalconverter (ADC) 130, which converts those versions of the I and Qsignals to digital I and Q signals (i.e., I and Q samples). Exemplaryembodiments of ADC 130 use a variety of signal conversion techniques(e.g., delta-sigma (i.e., sigma-delta) analog to digital conversion).ADC 130 provides the digital I and Q signals to signal processingcircuitry 132. In general, signal processing circuitry 132 performsprocessing (e.g., demodulation, frequency translation (e.g., using mixer131), filtering, or signal correction) of the digital I and Q signals.In at least one embodiment, signal processing circuitry 132 includesdemodulator 141, which retrieves or extracts information from digital Iand Q signals (e.g., data signals, that were modulated by a transmitter(not shown) and provided to antenna 101 as RF signals). In at least oneembodiment, one or more circuits of signal processing circuitry 132converts digital I and Q signals from a Cartesian representation intopolar representation (i.e., instantaneous phase and instantaneousamplitude) for use by frequency correction circuit 142 or phaseaveraging circuit 143. In at least one embodiment, signal processingcircuitry 132 (described further below) generates at least onecorrection value for application to local oscillator 115 or othercircuit of receiver 116.

In at least one embodiment, signal processing circuitry 132 providesinformation, such as the demodulated data or phase measurements, to dataprocessing circuitry 138. Data processing circuitry 138 may perform avariety of functions (e.g., logic, arithmetic, etc.). For example, dataprocessing circuitry 138 may use the demodulated data in a program,routine, or algorithm (whether in software, firmware, hardware, or acombination thereof) to perform desired control or data processingtasks. In at least one embodiment, data processing circuitry 138, whichincludes memory 136, controls other circuitry, sub-system, or systems(not shown).

In at least one embodiment, phase averaging circuit 143 or other circuitwithin signal processing circuit 132 computes a phase value (i.e., anangle value) for each pair of filtered, versions of digital I and Qsignals received from digital filters 140 during a measurement intervalof receiver operation and generates a phase measurement for a phasemeasurement interval. The phase measurement interval can have differentvalues by negotiation between the initiator and reflector. In anexemplary embodiment, a phase measurement interval of 80 μs is used.This interval is relatively long enough to include averaging ofmeasurements that increase accuracy of the phase measurements used fordistance measurements. FIG. 3 illustrates an exemplary prior arttechnique for computing a phase measurement by integrating digital I andQ baseband (ZIF) signals (e.g., averaging N I samples and N Q samples,where Nis an integer greater than one indicating the number of samplesin a measurement interval) using corresponding integrator circuits 302and 304 during the measurement interval and then providing theintegrated digital I signal and the integrated digital Q signal toarctangent circuit 306, which computes a single angle measurement thatis the arctangent of the integrated digital Q signal divided by theintegrated digital I signal. The integrating suppresses noise andfrequency offset prior to computation of the angle measurement. In atleast one embodiment of the receiver, the technique of FIG. 3 isadequate to meet specifications in systems having a low frequency offset(e.g., a frequency offset of ±4 ppm). However, in environments that havegreater frequency offsets (e.g., a system including an initiator and areflector that have frequency offsets up to 80 ppm), errors of ±π (i.e.,3.14159 radians) occur. To achieve 0.5 m accuracy of a correspondingdistance measurement, the sum of phase errors from all sources must beless than 0.1 radians, thus improved techniques for performing phasemeasurements are desired.

FIG. 4 illustrates a technique that performs phase measurement withimproved signal-to-noise ratios as compared to phase measurement usingthe technique of FIG. 3 and reduces or eliminates errors due to phaseboundary transitions. Arctangent circuit 306 computes N phase valuesbased on N I and Q baseband (ZIF) samples during the measurementinterval (e.g., 80 μsec). In at least one embodiment of a wirelesscommunications system, the local oscillator operates at 2.4 GHz, thewavelength is approximately 12 cm, and the phase delay between theinitiator transmitter LO and the reflector receiver LO increases (i.e.,accumulates) over the interval due to frequency offset. The accumulatedphase delay is proportional to distance and it may be necessary tounwrap the phase response to ensure that all appropriate multiples of 2πare included in the sum. Unwrap circuit 308 counts the number of cyclesof 2π by detecting a phase jump at the π to −π boundary in the digitalrepresentation of the angle. The cycle count is added to theinstantaneous angle to form the unwrapped angle. Averaging suppressesnoise and frequency offset after computation of each angle measurement.In at least one embodiment, a target worst-case frequency offset of ±80ppm at 2.4 GHz corresponds to phase wrapping every 5.2 μsec.

In at least one embodiment, arctangent circuit 306 performs anarctangent function having a range of 0 to 2π (i.e., all fourquadrants). In at least one embodiment, arctangent circuit 306 firstcomputes the angle assuming that the I and Q sample is in the firstquadrant (e.g., angle=arctan(abs(Q)/abs(I)). Next, arctangent circuit306 examines the sign of the Q sample and the sign of the I sample toplace the wrapped angle in the proper quadrant (first, second, third, orfourth) by adding the corresponding multiples of π to the angle computedassuming that both the Q sample and the I sample are positive.Arctangent circuit 306 provides wrapped angle values. Unwrap circuit 308observes the wrapped input angle values and adds 2π to an input anglevalue as needed to unwrap that input angle value. In general, wrappedangles refer to angle values that are contained to the range between −πand π radians. Unwrap circuit 308 provides unwrapped angle values toaveraging circuit 310. In general, an unwrap circuit adds appropriatemultiples of a to each angle input to restore original phase values. Inat least one embodiment, unwrap circuit 308 adds M×2×π to the anglevalue. Averaging circuit 310 averages N unwrapped angle values, whereNis the number of samples in the averaging interval, and provides theaverage angle value to wrap circuit 312. In at least one embodiment,wrap circuit 312 performs a modulo 2π operation on the average value toprovide a wrapped average angle value between −π and π or between 0 and2π. In at least one embodiment, average circuit 310 accumulates anglevalues using a fixed-point representation of a single binary word havingan integer portion and a fractional portion. The integer portionrepresents the number of cycles of 2π and the fractional portionrepresents the residual phase. The accumulated fixed-pointrepresentation is truncated to the fractional portion to wrap the angleback between −π and π. This technique results in reduced phasemeasurement errors as compared to the technique of FIG. 3. The approachof FIG. 4 achieves a higher signal-to-noise ratio measurement, increasedtolerance to frequency errors between the initiator and the reflector,and does not result in erroneous phase measurements since phase wrappingis taken into account.

Hybrid variations of the techniques of FIGS. 3 and 4 are illustrated inFIGS. 5 and 6. The techniques of FIGS. 5 and 6 provide the digital I andQ signals to integrator 302 and integrator 304, respectively, whichintegrate the digital I and Q signals before the arctangent computation.Similarly to the technique of FIG. 3, the technique of FIG. 5 performs asingle angle computation. Unlike the technique of FIG. 3, which ignoreswrapping, the technique of FIG. 5 monitors the signs of the digital Iand Q signals to detect when the samples wrap around 2π and alleviatespotentially large errors that may result from that wrapping. However,the noise filtering properties are inferior to the noise filteringproperties of the technique of FIG. 4.

FIG. 6 illustrates a technique that integrates P samples of the digitalI and Q signals before performing the angle calculation, thus performingN/P angle computations as compared to N angle computations of thetechnique of FIG. 4. The technique of FIG. 6 uses a reset signal toimplement an integrate and dump operation of I and Q samples, followedby a series of phase values and corresponding average of those phasevalues over an interval (e.g., 4 μsec) that is a fraction of themeasurement interval to prevent wrapping, and to reduce the number ofarctangent computations. Integrators 302 and 304 integrate P I and Qsamples (e.g., 10, which is a fraction of the number of phase valuesmade during a phase measurement interval) and provide N/P integrated Iand Q samples to arctangent circuit 306, followed by unwrap circuit 308and averaging circuit 310, which averages the N/P unwrapped phasevalues. Wrap circuit 312 generates a phase measurement based on theaverage unwrapped phase value. This technique reduces the number ofarctangent computations needed and reduces error as compared to thetechnique of FIG. 3.

In at least one embodiment, arctangent circuit 306 is implemented usinga COordinate Rotation DIgital Computer (CORDIC), which may be dedicatedto the phase measurement implementation or shared with other operationsof the receiver. In general, a CORDIC implements known techniques toperform calculations, including trigonometric functions and complexmultiplies, without using a multiplier. The only operations the CORDICuses are addition, subtraction, bit-shift, and table-lookup operationsto implement the arctangent function. In other embodiments, a digitalsignal processor executing firmware or an arctangent circuit is used. Inat least one embodiment, the communications system stores the resultingangle measurements in memory for use in distance calculations. In atleast one embodiment, the communications system applies a phasecorrection term (PCT) to the resulting angle measurements and stores thephase corrected angle measurements in memory for use in distancemeasurements.

Referring to FIG. 1, in general, the PCT is applied to received samplesto compensate for the propagation delay between the initiator antennaand the reflector antenna. In at least one embodiment, the PCT ischaracterized at the antenna although signals are observed at differentpoints in the receiver path. PCT_(R) is applied to received samples atthe reflector to compensate for the propagation delay t_(p) between theinitiator antenna and the reflector antenna. Similarly, PCT_(I) isapplied to received samples at the initiator to compensate for thepropagation delay t_(p) between the initiator antenna and the reflectorantenna. For example:

PCT_(R)(t)=2π(f _(initiator) −f _(reflector))t _(reflector)+2πf_(reflector) t _(p)+θ_(initiator)−θ_(reflector) +n _(reflector)(t), and

PCT_(I)(t)=2π(f _(reflector) −f _(initiator))t _(initiator)+2πf_(initiator) t _(p)+θ_(reflector)−θ_(initiator) +n _(initiator)(t).

In at least one embodiment of wireless communications system 100, thePCT measurements are:

${{PCT}_{R} = {{\Sigma\frac{{PCT}_{R}\left( {nT}_{s} \right)}{N}} = {{\Sigma\left\lbrack {{2{\pi\left( {f_{initiator} - f_{reflector}} \right)}{nT}_{s}} + {2\pi\; f_{reflector}t_{p}} + \theta_{initiator} - \theta_{reflector} + {n_{reflector}{nT}_{s}}} \right\rbrack}\text{/}N}}};$${PCT}_{I} = {{\Sigma\frac{{PCT}_{I}\left( {nT}_{s} \right)}{N}} = {{\Sigma\left\lbrack {{2{\pi\left( {f_{reflector} - f_{initiator}} \right)}{nT}_{s}} + {2\pi\; f_{initiator}t_{p}} + \theta_{reflector} - \theta_{initiator} + {n_{initiator}{nT}_{s}}} \right\rbrack}\text{/}{N.}}}$

Under ideal conditions, PCT_(R)=PCT_(I) and the noise terms for bothaverage to negligible values. Thus,

PCT_(R)+PCT_(I)=2πf _(reflector) t _(p)+2πf _(initiator) t _(p).

The phase measurements at the initiator and reflector must use the sameamount of time for cancellation of

2π(f _(initiator) −f _(reflector))t _(reflector)+2π(f _(initiator) −f_(reflector))t _(initiator).

However, if the initiator and reflector frequencies are mismatched, thefrequency offset between the frequency of the reflector local oscillatorand the frequency of the initiator local oscillator (i.e.,f_(EST)=f_(reflector)−f_(initiator)) must be estimated and compensatedmaking the measurement time less relevant:

2π(f _(reflector) −f _(initiator) −f _(EST))t _(initiator)=0.

Referring to FIGS. 1 and 7, in at least one embodiment, wirelesscommunications system 100 implements a BLE communications protocol thatperforms frequency compensation at the initiator to reduce the frequencyoffset (i.e., f_(initiator)−f_(reflector)) between the frequency of theinitiator local oscillator and the frequency of the reflector localoscillator. However, implementation of frequency compensation by aninitiator manufactured by another vendor may be inadequate to reduce thefrequency offset to a level that provides distance measurements withintarget accuracy specifications (e.g., ±4 ppm). Accordingly, in at leastone embodiment of wireless communications system 100, the reflectorimplements a frequency compensation technique that occurs during afrequency compensation interval of an electronic handshake processperformed by communications devices to establish communicationscompliant with a target communications protocol.

Although wireless communications device 102 is configured as aninitiator that performs frequency compensation during a first interval(e.g., a frequency compensation interval), wireless communicationsdevice 112, which is configured as a reflector, also performs frequencycompensation during the first interval, but prior to the initiatorfrequency offset compensation. During the first interval, wirelesscommunications system 100 operates the receiver in LIF mode. Theinitiator transmits a packet during initiator interval 702 and thereflector receives that packet during reflector interval 722. Thereflector determines frequency offset f_(EST) and generates anassociated adjustment value during reflector interval 722 using aportion of the packet received from the initiator. An exemplary packetformat includes a preamble having a predefined data pattern that areceiver can use to detect and settle its control loops, e.g., aneight-bit sequence of alternating ones and zeros, and a payload withlength of zero. In at least one embodiment, the packet includes apreamble, a 32 bit sync word, e.g., PN sequence pn[31:0], and a 96 bitsounding sequence. In an embodiment the PN sequence is a 32-bitPseudo-Noise sequence also referred to as a Pseudo-Random BinarySequence (PRBS) that is known to both the initiator and reflector. In anembodiment the sync word is an address or other identifier associatedwith the receiver that marks the beginning of the sounding sequence. Inother embodiments, the reflector determines frequency offset f_(EST)based on a packet received in the ZIF mode of operation.

The reflector determines a frequency offset using sequential samples ofthe preamble, the sync word, or combination thereof, and applies anadjustment based on that frequency offset to the reflector localoscillator 115. That adjustment is effective for the transmission of apacket during reflector interval 724 and the remainder of the firstinterval and at least during a second interval used to perform distancemeasurements (e.g., an interval including a packet exchange subintervaland a phase measurement subinterval). The initiator receives that packetduring initiator interval 704, followed by a continuous wave tone, whichis transmitted by the reflector during reflector interval 726 andreceived during initiator interval 706. In an exemplary embodiment ofwireless communications system 100, the packet and the continuous wavetone received by the initiator in interval 704 and initiator interval706, respectively, will have a reduced frequency offset (e.g., afrequency offset of 5 kHz or less). The initiator uses the receivedpacket and the received continuous wave tone to determine frequencyoffset f_(EST2) (e.g., using an estimation technique described herein,or other technique for estimating frequency offset), and applies anassociated adjustment to initiator local oscillator 105, if needed.

During the second interval of FIG. 7, the reflector compensates for thefrequency offset between the initiator and reflector to a negligiblevalue that makes the measurement starting point and duration of the PCTirrelevant. In an exemplary embodiment of wireless communications system100, the second interval includes a packet exchange subinterval and aphase measurement subinterval. In the packet exchange subinterval, theinitiator transmits a packet during initiator interval 708 and thereflector receives that packet during reflector interval 728. Similarly,the reflector transmits a packet during reflector interval 730, and theinitiator receives that packet during initiator interval 710. In otherembodiments of wireless communications system 100, the packet exchangesubinterval is omitted.

In at least one embodiment, wireless communications system 100 includesa ZIF mode of operation, which is used during the phase measurementsubinterval. In the ZIF mode of operation, the initiator and reflectorcommunicate baseband intermediate frequency (i.e., ZIF) signals. Sincebaseband signals are at or near DC, the ZIF mode reduces or eliminates aphase shift of the received signals through baseband circuits, ADC, anddigital filters, that could affect distance measurements based on phasemeasurements. Thus, the phase shift through those circuits need not beknown or calibrated and the use of the ZIF mode of operation simplifiesthe phase measurements. In at least one embodiment of wirelesscommunications system 100, the reflector transmits continuous wave toneCWT_(f1) during reflector interval 732 and the initiator measures phaseϕ_(I) using a received version of continuous wave tone CWT_(f1) duringinitiator interval 712. Similarly, the initiator transmits continuouswave tone CWT_(f2) during initiator interval 714 and the reflectormeasures phase ϕ_(R) using a received version of continuous wave toneCWT_(f2) during reflector interval 734. Wireless communications system100 repeats the phase measurements for additional values of i, where1≤i≤I (e.g., I=70 and corresponds to 70 spaced carriers over an 80 MHzchannel at 2.4 GHz). In at least one embodiment of wirelesscommunications system 100, the reflector determines a residual frequencyoffset f_(ESTR) using the version of continuous wave tone CWT_(fi)received in the ZIF mode. In addition, an adjustment based on theresidual frequency offset is applied to the PCT at the input of thedemodulator to compensate for a frequency rotation of the phasecorrection value. The initiator determines a roundtrip phase ϕ_(RT)after the second interval.

In the ZIF mode of operation, self-mixing can cause a DC offset that isa substantial source of error. In an exemplary embodiment of wirelesscommunications system 100, analog I and Q signals have levels ofapproximately 20 mV peak-to-peak with a received signal close to thesensitivity level. The residual DC offset is specified to be much lessthan 1 mV DC to reduce or eliminate phase error due to the DC offsetshifting the I and Q signals. Since information is communicated at DC inthe ZIF mode of operation, conventional techniques for attenuating DCoffset (e.g., high pass filtering using a series AC coupling capacitor)are not feasible. In at least one embodiment, wireless communicationssystem 100 includes a calibration mode of operation that estimates theDC offset, generates DC offset compensation values, and stores those DCoffset compensation values in storage elements for later use during anormal mode of operation.

FIG. 8 illustrates receiver 116 configured in a calibration mode ofoperation in which the receiver input is coupled to a reference node(e.g., ground) to null the receiver input signal. In the calibrationmode of operation, receiver 116 is also configured in the ZIF mode ofoperation. In at least one embodiment of digital filters 140, during thecalibration mode of operation, the switches are configured in position1, causing the low-pass filter output to be subtracted from the inputsignal. After a predetermined amount of time, controller 139 stores theFINAL DC ESTIMATE for later use during a normal mode of operation. In atleast one embodiment, analog circuits (e.g., a programmable gainamplifier or analog-to-digital converter) have multiple settings andcontroller 139 configures receiver 116 to estimate the DC offset foreach setting of the analog circuits and stores each estimate in acorresponding storage element or memory location (e.g., in a lookuptable).

In at least one embodiment of digital filters 140, in the calibrationmode of operation, while computing the low-pass filter output,controller 139 configures the switches in position 1 to couple thedifference node to receive the corresponding current low-pass filteroutput value. While computing an updated value of the low-pass filteroutput, the corresponding digital signal is compensated by the currentlow-pass filter output value and controller 139 compares thatcompensated value (e.g., the output of the difference node) to apredetermined value (e.g., 0). If the difference is less than or equalto the predetermined value, the controller causes the low-pass filteroutput to be stored as the FINAL DC ESTIMATE for later use during anormal mode of operation. In at least one embodiment, analog circuits(e.g., a programmable gain amplifier or analog-to-digital converter)have multiple settings and controller 139 configures receiver 116 toestimate the DC offset for each setting of the analog circuits andstores each estimate in a corresponding storage element or memorylocation (e.g., in a lookup table).

In at least one embodiment, for each setting of the analog circuits,controller 139 first operates the low-pass filter using a firstcoefficient (e.g., k=k₁) to cause the low-pass filter to have a firsttime constant of the low-pass filter, and after a predetermined numberof samples controller 139, updates the low-pass filter to use a secondcoefficient (e.g., k=k₂) to cause the low-pass filter to have a secondtime constant, where the second time constant is longer than the firsttime constant (e.g., |k₁|>|k₂|) to expedite convergence of the low-passfilter output values. In an alternate embodiment, controller 139 startsthe low-pass filter configured to operate with the first time constantof the low-pass filter and in response to the compensated signal beingbelow a threshold value (i.e., indicating convergence) controller 139,changes the value of k to second value k₂ associated with a second timeconstant of the low-pass filter. In at least one embodiment, additionalvalues of k are used to further control the DC estimate convergence. Thelow-pass filters can be single-pole infinite impulse response low-passfilter circuits, moving average circuits, or other finite impulseresponse low pass filter circuits or infinite impulse response low passfilter circuits of varying order.

After calibration mode is completed for each setting of the analogcircuit, in a normal mode of operation in which receiver 116 isconfigured in the ZIF mode of operation, controller 139 configuresswitches in position 2 to couple a STORED DC ESTIMATE corresponding toan active setting of the analog circuit (e.g., an active setting of thePGA) to corresponding difference nodes to compensate for the DC offsetin the digital I and Q signals received by digital filters 140. Forexample, in a ZIF mode of the normal mode of operation, the estimates ofthe DC offset is subtracted from the digital I and Q signals and thedifferences are provided as DC offset compensated digital I and Qsignals (i.e., I_(C) and Q_(C)) to CORDIC 137 or other digitalprocessing circuit for further processing. In a normal mode of operationin which receiver 116 is configured in the LIF mode of operation,controller 139 configures switches in position 1 and the digital filters140 are configured as high pass filter that blocks DC for LIF mode ofoperation.

Referring to FIG. 9, in at least one embodiment, receiver 116 implementsphase measurements consistent with the technique described withreference to FIG. 4. In addition, receiver 116 estimates frequencyoffset f_(EST) and residual frequency offset f_(ESTR) and thoseoperations share CORDIC 137. In at least one embodiment, CORDIC 137receives samples (e.g., filtered, versions of digital I and Q signals)from digital filters 140 and converts the digital I and Q signals from aCartesian representation into a polar representation using thePythagorean theorem to compute the amplitude (e.g., amplitude=√{squareroot over (I²+Q²)}) and an arctangent operation (e.g., arctan (Q/I)) tocompute the phase values used by frequency correction circuit 142 andphase averaging circuit 143 to compute frequency offset estimatef_(EST), residual frequency offset estimate f_(ESTR), and phasemeasurement ϕ.

In at least one embodiment, receiver 116 is configured in a normal modeof operation as a ZIF receiver including phase averaging circuit 143which averages phase measurements during a phase measurement interval,as described above. Unwrap circuit 144 receives the phase values,adds/subtracts M×2×π, to the phase values to generate the unwrappedphase values, and provides the unwrapped phase values to averagingcircuit 150. The unwrap circuit counts the number of π/−π boundarycrossings to determine the cycle count M. Averaging circuit 150 averagesN unwrapped phase values, where Nis an integral number of samples in ameasurement interval. Averaging circuit 150 provides the average,unwrapped value to wrap circuit 154. Wrap circuit 154 performs a modulo2π operation on the average, unwrapped value to provide a wrapped phasemeasurement ϕ to PCT circuit 158. In at least one embodiment, wrapcircuit 154 wraps the phase to be within a digital representation of ±π.PCT circuit 158 applies frequency and delay corrections to phasemeasurement ϕ to calculate the phase correction term consistent with thePCT described above. In at least one embodiment, the reflector storesthe corrected phase measurement for use in a distance measurementperformed by data processing circuitry 138. In other embodiments, thereflector transmits the phase-corrected phase measurement to theinitiator for use in a distance measurement computed at the initiator.

In at least one embodiment, in a normal mode of operation receiver 116is selectively configured as an LIF receiver (e.g., a digital mixer, notshown, is active in the receiver path) or a ZIF receiver. Frequencyoffset estimator 148 receives phase values from CORDIC 137 and generatesfrequency offset estimate f_(EST) (i.e.,f_(EST)=f_(reflector)−f_(initiator)). For example, frequency offsetestimator 148 differentiates the phase output of the CORDIC by computingdiscrete time phase difference values (e.g., ϕ[n]−ϕ[n−1]=f_(X)).Frequency offset estimator 148 subtracts a value corresponding to anexpected phase difference value, which is predetermined and stored inmemory, from the incoming discrete time phase difference values,accumulates the error, and divides by a predetermined number of symbols(e.g., 8≤N≤32 symbols) to form an estimate of the frequency error. Theexpected phase difference values are based upon the specified frequencydeviation f_(DEV) for the physical layer (e.g., ±250 kHz).

For example, for frequency shift keying, when transmitting a ‘1,’ thetransmitter transmits a radio frequency tone having frequencyf_(RF)+f_(DEV), and when transmitting a ‘0,’ the transmitter transmits atone having frequency f_(RF)−f_(DEV). In an exemplary embodiment thatuses the eight symbols of the preamble to estimate the frequency error,expected values ξ₁, ξ₂, ξ₃, −ξ₁, −ξ₂, −ξ₃, which correspond to theexpected instantaneous frequency deviation (i.e., the phase differenceover a symbol) are stored in memory. Values of ξ₁, ξ₂, and ξ₃ vary withthe system BT parameter (e.g., bandwidth×bit time=0.5), which determinesthe effects of transmitter pulse shaping, and receiver filteringbandwidth. In at least one embodiment, effects of filtering in thereceiver and transmitter pulse shaping from one bit can affectsubsequent bits, which is known as Inter-Symbol Interference (ISI). Ifsequential symbols include a relatively long run of ‘1’s, the fullfrequency deviation is expected (e.g., If sequential symbols alternatebetween ‘1’ and ‘0’, the expected frequency deviates less than the fullfrequency deviation due to effects of the filtering (e.g., ±ξ₃). Eachexpected value corresponds to a different data pattern of three bits(i.e., b_(n), b_(n-1), and b_(n-2)). Exemplary values of ξ₁, ξ₂, and ξ₃correspond to expected deviations f_(DEV) of 250 kHz, 173 kHz, and 92kHz, respectively, after receiver filtering. However, the expecteddeviations will vary according to characteristics of filteringimplemented in the receiver. If sequential symbols include a relativelylong run of ‘1’s, the full frequency deviation (e.g., 250 kHz) isexpected and if an exemplary transmitter has an offset of 50 kHz, thenthe transmitted signal has a frequency of f_(RF)+f_(DEV)+50 kHz.Accordingly, frequency offset estimator 148 would compute the averagefrequency offset value as follows:

${\frac{1}{N}{\sum\limits_{i = 0}^{N - 1}\;{{f_{x} - f_{expected}}}}} = {{\frac{1}{N}{\sum\limits_{i = 0}^{N - 1}\;{{{300\mspace{14mu}{kHz}} - {250\mspace{14mu}{kHz}}}}}} = {50\mspace{14mu}{{kHz}.}}}$

Frequency offset estimator 148 provides an average frequency offsetvalue as frequency offset estimate f_(EST) to frequency correctioncircuit 160 once per packet. In at least one embodiment, frequencycorrection circuit 160 generates a frequency adjustment value based onthe frequency offset estimate f_(EST) (e.g., by negating the averagefrequency offset value) and combines it with other control values (FREQor IFREQ) to generate LOCONTROL. For example, LOCONTROL controls localoscillator 126 (e.g., controls a fractional-N phase-locked loop 164) sothat the reflector local oscillator frequency matches the initiatorlocal oscillator frequency within a target specification (e.g., ±4 ppm).

In at least one embodiment, while receiver 116 is configured as a ZIFreceiver receiving a continuous wave tone having the frequency of theinitiator local oscillator, unwrap circuit 144 is shared with frequencycorrection circuit 142 and provides the unwrapped phase values tophase-to-frequency circuit 146, which generates frequency estimatesbased on the unwrapped phase values (e.g., by computing discrete timephase difference values (e.g., ϕ[n]−ϕ[n−1])). If the initiator localoscillator is perfectly matched to local oscillator 126, then the outputof mixer 124 is a DC signal and the output of phase-to-frequency circuit146 is zero. If the initiator local oscillator and the reflector localoscillator are mismatched, then the output of mixer 124 is not a DCsignal, and the frequency estimate output of phase-to-frequency circuit146 is an estimate of the residual frequency offset between theinitiator local oscillator and the reflector local oscillator. In atleast one embodiment of phase-to-frequency circuit 146, rather thanusing adjacent unwrapped phase values, phase-to-frequency circuit 146computes discrete time phase difference values using non-adjacentunwrapped phase values (e.g., ϕ[n]−ϕ[n−2]) to improve accuracy. Usingnon-adjacent values improves accuracy by increasing the expected phasedifference above the quantization limit of the system.Phase-to-frequency circuit 146 provides the frequency offset estimatesto averaging circuit 152, which averages N values and provides theaverage phase difference (i.e., the average frequency, e.g., the averagefrequency offset when receiver 116 is receiving a continuous wave tonehaving the frequency of the initiator local oscillator) to wrap circuit156. Wrap circuit 156 wraps that average phase difference (i.e.,frequency error) to be within the limits of the output format (e.g., towithin ±400 kHz). In an exemplary embodiment, the average frequencyoffset will not exceed the limits of the output format since thefrequency correction applied based on frequency offset estimate f_(EST)brings the frequency offset within a narrower range (e.g., 15 kHz).Excess margin accommodates a maximum tolerated frequency drift (e.g., 20Hz/μsec). Wrap circuit 156 provides a wrapped average frequency value asresidual frequency offset estimate f_(ESTR) to frequency correctioncircuit 160. In some embodiments, wrap circuit 156 provides residualfrequency offset estimate f_(ESTR) to PCT circuit 158, which convertsresidual frequency offset estimate f_(ESTR) to radians based on themeasurement period (e.g., f_(ESTR)×½ the period of interval 734 of FIG.7). Referring back to FIG. 9, although frequency correction circuit 142is described in an embodiment that generates residual frequency offsetestimate f_(ESTR) while receiver 116 is configured in a ZIF mode ofoperation, in other embodiments, frequency correction circuit 142generates residual frequency offset estimate f_(ESTR) while receiver 116is configured in a LIF mode of operation (e.g., during frequencycompensation performed in interval 728 of FIG. 7). Referring back toFIG. 9, in at least one embodiment, frequency correction circuit 160uses the residual frequency offset estimate f_(ESTR) as a frequencycompensation value. In at least one embodiment, frequency correctioncircuit 160 generates a frequency compensation value based on theresidual frequency offset estimate f_(ESTR).

In at least one embodiment, frequency correction circuit 160 combines acompensation value based on the residual frequency offset estimatef_(ESTR) with another compensation value based on the frequency offsetestimate f_(EST) to generate a control signal for adjusting thefrequency of local oscillator 126. In at least one embodiment, frequencycorrection circuit 160 combines residual frequency offset estimatef_(ESTR), when available, with frequency offset estimate f_(EST) togenerate control signal LOCONTROL. In some embodiments, frequencycorrection circuit 160 combines residual frequency offset estimatef_(ESTR), when available, with frequency offset estimate f_(EST) andother parameters that specify a target frequency in ZIF mode or targetfrequency in LIF mode, to generate digital signal LOCONTROL thatdetermines the frequency of local oscillator 126 (e.g., a digitalcontrol signal used to control fractional-N phase-locked loop 164). Inat least one embodiment, frequency correction circuit 160 (or otherstructures described herein) is implemented using software executing ona processor (which includes firmware) or by a combination of softwareand hardware. Software, as described herein, may be encoded in at leastone tangible (i.e., non-transitory) computer readable medium. Asreferred to herein, a tangible computer-readable medium includes atleast a disk, tape, or other magnetic, optical, or electronic storagemedium.

Referring to FIG. 1, in at least one embodiment, wireless communicationssystem 100 compensates for frequency offset between wirelesscommunications device 102, which is configured as an initiator operatingin a LIF mode, and wireless communications device 112, which isconfigured as a reflector operating in a LIF mode. In other embodimentsof wireless communications system 100, wireless communications device112 is configured as a reflector and wireless communications device 102is configured as an initiator and wireless communications system 100compensates for the associated frequency offset using the sequence ofFIG. 10. Referring to FIGS. 1 and 10, during interval T1, receiver 106of the initiator and receiver 116 of the reflector each generate analogDC offset compensation values for each setting of an analog circuit(e.g., each gain level of a programmable gain amplifier), consistentwith techniques described above. After the DC offset compensation,transmitter 104 of the initiator transmits a packet to the reflectoroperating its receiver in LIF mode. Receiver 116 of the reflectorestimates a frequency offset using the preamble of the packet toestimate frequency offset f_(EST) during interval T2. Next, duringinterval T3, the initiator transitions from a transmitting mode ofoperation to a receiving mode of operation, the reflector transitionsfrom a receiving mode of operation to a transmitting mode of operation,and the reflector configures its local oscillator (e.g., oscillator 115)to compensate for frequency offset f_(EST). In interval T4, thereflector sends a packet to the initiator using local oscillator 115compensated for frequency offset f_(EST). The initiator uses that packetto estimate and compensate for a first initiator frequency offset,thereby reducing any frequency offset. The initiator and reflectortransition from a packet mode of communication to a continuous wave tonemode of communication in interval T5 and the reflector transmits acontinuous wave tone to the initiator in interval T6, which theinitiator uses to estimate and compensate for a fine initiator frequencyoffset, thereby further reducing any frequency offset.

In at least one embodiment, after the sequence of intervals T1-T6 inwhich the initiator and reflector perform frequency estimation andcompensation, wireless communications system 100 performs packetexchange and tone exchange communications, which include phasemeasurements at the initiator and the reflector and residual frequencyoffset estimation and compensation by the reflector. Referring to FIGS.1 and 11, during interval T7, the initiator transitions from a receivingmode of operation to a transmitting mode of operation, the reflectortransitions from a transmitting mode of operation to a receiving mode ofoperation, the reflector operates its receiver in LIF mode, and theinitiator and the reflector adjust their respective local oscillators tooperate at target frequency f₁. The initiator transmits asynchronization packet including a sounding sequence or otherinformation, that is received by the reflector in interval T8 and thereflector performs synchronization operations. In interval T9, theinitiator transitions from a transmitting mode of operation to areceiving mode of operation and the reflector transitions from areceiving mode of operation to a transmitting mode of operation. Thereflector transmits a synchronization packet including a soundingsequence or other information that is received by the initiator ininterval T10 and the initiator performs synchronization operations.Next, in interval T11, wireless communications system 100 transitionsfrom packet mode to continuous wave tone mode and from LIF mode ofoperation to ZIF mode of operation, with the automatic gain controlfixed to a predetermined setting.

In interval T12, the reflector transmits a continuous wave tone having afrequency f_(i), where i is an integer, 1≤i≤I, and I≥2. The initiatorreceives the continuous wave tone in ZIF mode of operation and measuresphase, as described above. Wireless communications system 100transitions the reflector device from a transmitting mode of operationto a receiving mode of operation and the initiator device from thereceiving mode of operation to the transmitting mode of operation duringinterval T13. The initiator transmits a continuous wave tone havingfrequency f_(i) and the reflector measures phase based on the receivedcontinuous wave tone and determines residual frequency offset estimatef_(ESTR). Wireless communications system 100 repeats the sequencesperformed in intervals T12-T14 for a next value of I (i.e., performs thesequence for no fewer than two different frequencies). In at least oneembodiment, after making i phase measurements, the reflector sends thephase measurements to the initiator for generating distancecalculations. Note that the sequences of FIGS. 10 and 11 are exemplaryonly and techniques described herein can be adapted for use in othercommunications sequences.

Thus, techniques for measuring distance between a first communicationsdevice and a second communications device using phase measurements havebeen disclosed. The description of the invention set forth herein isillustrative and is not intended to limit the scope of the invention asset forth in the following claims. For example, while the invention hasbeen described in an embodiment of a receiver in which the phasemeasurement technique illustrated in FIG. 4 is implemented, one of skillin the art will appreciate that teachings herein can be utilized with areceiver implementing phase measurement techniques illustrated in FIG. 5or FIG. 6. In addition, while the invention has been described inembodiments where wireless communications devices coupled to antennasare used, one of skill in the art will appreciate that teachings hereincan be utilized with communications devices coupled to other radiofrequency sources (e.g., coaxial cable). The terms “first,” “second,”“third,” and so forth, as used in the claims, unless otherwise clear bycontext, is to distinguish between different items in the claims anddoes not otherwise indicate or imply any order in time, location orquality. For example, “a first received network signal,” “a secondreceived network signal,” does not indicate or imply that the firstreceived network signal occurs in time before the second receivednetwork signal. Variations and modifications of the embodimentsdisclosed herein may be made based on the description set forth herein,without departing from the scope of the invention as set forth in thefollowing claims.

1. A method for operating a radio frequency communications system, themethod comprising: while operating a first radio frequencycommunications device in a calibration mode, for each setting of aplurality of settings of a programmable gain amplifier in a receiver ofthe first radio frequency communications device operating in azero-intermediate frequency mode of operation, generating an estimate ofan offset in each of a plurality of digital samples received from acircuit path including the programmable gain amplifier and storing in acorresponding storage element, a compensation value based on theestimate of the offset.
 2. The method as recited in claim 1, wherein inthe calibration mode, an input of the receiver is coupled to a referencenode to null a receiver input signal.
 3. The method as recited in claim1, wherein generating the estimate of the offset comprises: convertingin-phase signals generated by the programmable gain amplifier to digitalin-phase samples of the plurality of digital samples; convertingquadrature signals generated by the programmable gain amplifier todigital quadrature samples of the plurality of digital samples;computing a first low-pass filtered signal based on the digital in-phasesamples; and computing a second low-pass filtered signal based on thedigital quadrature samples, wherein the compensation value comprises anin-phase compensation value based on the first low-pass filtered signaland a quadrature compensation value based on the second low-passfiltered signal.
 4. The method as recited in claim 3, wherein thestoring occurs after a predetermined number of the digital in-phasesamples and the digital quadrature samples are used to compute the firstlow-pass filtered signal and the second low-pass filtered signal.
 5. Themethod as recited in claim 3 further comprising: while operating thefirst radio frequency communications device in the calibration mode:compensating a digital in-phase sample of the digital in-phase sampleswith the first low-pass filtered signal to generate a compensatedin-phase sample; and compensating a digital quadrature sample of thedigital quadrature samples with the second low-pass filtered signal togenerate a compensated quadrature sample, wherein the storing occurs inresponse to the compensated in-phase sample or the compensatedquadrature sample being below a predetermined threshold value.
 6. Themethod as recited in claim 3, wherein computing the first low-passfiltered signal comprises: multiplying each first digital in-phasesample received during a first interval by a first coefficient; andmultiplying each second digital in-phase sample received during a secondinterval by a second coefficient, wherein computing the second low-passfiltered signal comprises: multiplying each first digital quadraturesample received during the first interval by the first coefficient; andmultiplying each second digital quadrature sample received during thesecond interval by the second coefficient, and wherein a first magnitudeof the first coefficient is greater than a second magnitude of thesecond coefficient and the first interval occurs prior to the secondinterval.
 7. The method as recited in claim 1 further comprising: whileoperating the first radio frequency communications device in azero-intermediate frequency mode of a normal mode of operation of thefirst radio frequency communications device: generating offsetcompensated samples using the compensation value corresponding to anactive setting of the plurality of settings of the programmable gainamplifier.
 8. The method as recited in claim 7, wherein in the normalmode of operation, an input of the receiver is communicatively coupledto a radio frequency signal source.
 9. The method as recited in claim 7further comprising: configuring the programmable gain amplifier to havea first setting of the plurality of settings; and loading an in-phasecompensation value and a quadrature compensation value corresponding tothe first setting into a first register of the receiver and a secondregister of the receiver, respectively, wherein generating the offsetcompensated samples includes compensating digital in-phase samples anddigital quadrature samples using contents of the first register and thesecond register, respectively.
 10. The method as recited in claim 7further comprising: while operating the first radio frequencycommunications device in the zero-intermediate frequency mode of thenormal mode of operation, generating a phase measurement based on theoffset compensated samples, wherein the phase measurement is indicativeof a phase difference between a first local oscillator of the firstradio frequency communications device and a second local oscillator of asecond radio frequency communications device and a distance between thefirst radio frequency communications device and the second radiofrequency communications device.
 11. A radio frequency communicationssystem comprising: a first radio frequency communications device havinga calibration mode of operation and a normal mode of operation, thefirst radio frequency communications device comprising: a receiverhaving a zero-intermediate frequency mode of operation and alow-intermediate frequency mode of operation, the receiver comprising: acircuit path comprising a programmable gain amplifier configurable tohave an active setting of a plurality of settings; and a digital circuitpath configured to receive a plurality of digital samples from thecircuit path, wherein, in the calibration mode of operation, thereceiver is configured in a zero-intermediate frequency mode and thedigital circuit path is configured to generate an estimate of an offsetin each of the plurality of digital samples and to store in a storageelement corresponding to the active setting, a compensation value basedon the estimate of the offset.
 12. The radio frequency communicationssystem as recited in claim 11, wherein in the calibration mode ofoperation, an input of the receiver is coupled to a reference node tonull a receiver input signal.
 13. The radio frequency communicationssystem as recited in claim 11, wherein the digital circuit pathcomprises: a first low-pass filter circuit configured to compute a firstlow-pass filter output based on digital in-phase samples of theplurality of digital samples; a second low-pass filter circuitconfigured to compute a second low-pass filter output based on digitalquadrature samples of the plurality of digital samples; a first storageelement corresponding to each of the plurality of settings of theprogrammable gain amplifier; a second storage element corresponding toeach of the plurality of settings of the programmable gain amplifier;and a control circuit configured to selectively enable each of theplurality of settings as the active setting and to store the firstlow-pass filter output in the first storage element and to store thesecond low-pass filter output in the second storage element.
 14. Theradio frequency communications system as recited in claim 13, whereinthe first low-pass filter circuit comprises a multiplier configured tomultiply each first digital in-phase sample of the digital in-phasesamples received during a first interval by a first coefficient and tomultiply each second digital in-phase sample of the digital in-phasesamples received during a second interval by a second coefficient, andwherein the second low-pass filter circuit comprises a second multiplierconfigured to multiply each first digital quadrature sample of thedigital quadrature samples received during the first interval by thefirst coefficient and to multiply each second digital quadrature sampleof the digital quadrature samples received during the second interval bythe second coefficient.
 15. The radio frequency communications system asrecited in claim 13, wherein the control circuit is configured to storethe first low-pass filter output in the first storage element and tostore the second low-pass filter output in the second storage elementafter a predetermined number of the digital samples are used to computethe first low-pass filter output and the second low-pass filter output.16. The radio frequency communications system as recited in claim 13,wherein the digital circuit path further comprises: a first compensationcircuit configured to compensate an in-phase sample of the plurality ofdigital samples with the first low-pass filter output to generate acompensated in-phase sample; and a second compensation circuitconfigured to compensate a quadrature sample of the plurality of digitalsamples with the second low-pass filter output to generate a compensatedquadrature sample, wherein the control circuit is configured to storethe first low-pass filter output in the first storage element and tostore the second low-pass filter output in the second storage element inresponse to the compensated in-phase sample or the compensatedquadrature sample being below a predetermined threshold value.
 17. Theradio frequency communications system as recited in claim 13, whereinthe receiver further comprises: an analog-to-digital converter coupledbetween the programmable gain amplifier and the digital circuit path,the analog-to-digital converter being configured to generate theplurality of digital samples based on a plurality of analog samples bythe programmable gain amplifier.
 18. The radio frequency communicationssystem as recited in claim 13, wherein the digital circuit path furthercomprises: a first compensation circuit configured to generate offsetcompensated in-phase samples based on the digital in-phase samples ofthe plurality of digital samples and the estimate of the offset in thezero-intermediate frequency mode of operation of the normal mode ofoperation; a second compensation circuit configured to generate offsetcompensated quadrature samples based on the digital quadrature samplesof the plurality of digital samples and the estimate of the offset inthe zero-intermediate frequency mode of operation of the normal mode ofoperation; and a phase measurement circuit configured to generate aphase measurement based on the offset compensated in-phase samples andthe offset compensated quadrature samples in the zero-intermediatefrequency mode of operation of the normal mode of operation, wherein thephase measurement is indicative of a phase difference between a firstlocal oscillator of the first radio frequency communications device anda second local oscillator of a second radio frequency communicationsdevice and a distance between the first radio frequency communicationsdevice and the second radio frequency communications device.
 19. Amethod for measuring a distance between a first radio frequencycommunications device including a first local oscillator and a secondradio frequency communications device including a second localoscillator, the method comprising: while operating a receiver of thefirst radio frequency communications device in a zero-intermediatefrequency mode: compensating digital in-phase samples with an in-phasecompensation value corresponding to an active setting of an analogsignal path; compensating digital quadrature samples with a quadraturecompensation value corresponding to the active setting of the analogsignal path; and generating a phase measurement based on the compensateddigital in-phase samples and the compensated digital quadrature samples,wherein the phase measurement is indicative of a phase differencebetween the first local oscillator and the second local oscillator andthe distance between the first radio frequency communications device andthe second radio frequency communications device.
 20. The method asrecited in claim 19 further comprising: in a calibration mode ofoperation of the first radio frequency communications device,determining the in-phase compensation value corresponding to the activesetting of the analog signal path and the quadrature compensation valuecorresponding to the active setting of the analog signal path based onan estimate of an offset introduced by the analog signal path.
 21. Themethod as recited in claim 1, wherein the offset is a direct current(DC) offset.